'use strict';
angular.module('app')
  .filter('filterByObj', [function() {
    return function(list, obj) {
      var result = [];
      angular.forEach(list, function(item) {
        var isEqual = true;
        for (var e in obj) {
          if (item[e] !== obj[e]) {
            isEqual = false;
          }
        }

        /*var isEqual = false;
        for (var e in obj) {
          if (item[e] === obj[e]) {
            isEqual = true;
          }
        }*/
        if (isEqual) {
          result.push(item);
        }
      });
      return result;
    }
  }])
